package com.sgj.service.impl;

import com.sgj.dao.UserRepository;
import com.sgj.pojo.User;
import com.sgj.service.UserService;
import com.sgj.utils.MD5Utils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @author 沈国纪
 * @date 2021/3/30 10:39
 */
@Service
public class UserServiceImpl implements UserService {

	@Autowired
	private UserRepository userRepository;

	/**
	 * 根据用户名和密码查找用户
	 * @param username
	 * @param password
	 * @return
	 */
	@Override
	public User checkUser(String username, String password) {
		User user = userRepository.findByUserNameAndPassword(username, MD5Utils.code(password));
		return user;
	}
}
